package domain.penum;
/**
 * 
* @ClassName: RoleEnum 
* @Description: 角色枚举
* @author chenchao
* @date 2014年1月29日 上午10:56:34 
*
 */
public enum RoleEnum {
	SUPPER("系统管理员",-1), ADMIN("公司管理员",1),SHOPKPPER("店长",2), MANAGER("经理",3),LEADER("组长 ",4),STAFF("普通员工",5),VISITOR("访客",6);
	
	private String name;
	private int index;
	
	private RoleEnum(String name,int index) {
		this.name = name;
		this.index = index;
	}
	
	
	// 普通方法  
		public static String getName(int index) {  
	        for (RoleEnum c : RoleEnum.values()) {  
	            if (c.getIndex() == index) {  
	                return c.name;  
	            }  
	        }  
	        return null;  
	    }  
		
		
		public static int getIndex(String name) {
			for (RoleEnum c : RoleEnum.values()) {  
				if (c.getName().equals(name)) {
					return c.index;
				}
			}
			return  -1;
		}


		/**
		 * @return the name
		 */
		public String getName() {
			return name;
		}


		/**
		 * @param name the name to set
		 */
		public void setName(String name) {
			this.name = name;
		}


		/**
		 * @return the index
		 */
		public int getIndex() {
			return index;
		}


		/**
		 * @param index the index to set
		 */
		public void setIndex(int index) {
			this.index = index;
		}
		
		
		
}
